Using the DebugDescription macro to display an optional value produces a “String interpolation produces a debug description for an optional value” build warning.
For example:
@DebugDescription
struct MyType: CustomDebugStringConvertible {
let optionalValue: String?
public var debugDescription: String {
"Value: \(optionalValue)"
}
}
The DebugDescription macro does not allow (it is an error)
"Value: \(String(describing: optionalValue))"
or
"Value: \(optionalValue ?? "nil")"
because “Only references to stored properties are allowed.”
Is there a way to reconcile these?
I have a build log full of these warnings, obscuring real issues.